package struts.util;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import struts.action.ActionForm;


public class FullForm {

	public FullForm() {
		super();
		
	}
	public static ActionForm fill(String formpath,HttpServletRequest request){
		ActionForm form = null;
		try{
			Class clazz=Class.forName(formpath);
			form=(ActionForm) clazz.newInstance();
			Field[] arr_field=clazz.getDeclaredFields();
			for(Field f:arr_field){
				f.setAccessible(true);
				f.set(form,request.getParameter(f.getName()));
				f.setAccessible(false);
				
			}
		}catch (Exception e) {
			e.printStackTrace();
		}
		return form;
		
		
	}     
	

}
